/**
 * WordPress Spider Monitor - SPA样式
 * 单页应用相关样式
 */

/* SPA容器样式 */
.spa-container {
    display: flex;
    min-height: 100vh;
    background: #f1f1f1;
}

/* 侧边导航栏 */
.spider-nav-sidebar {
    width: 250px;
    background: #23282d;
    color: #fff;
    padding: 20px 0;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.spider-nav-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid #3c434a;
    margin-bottom: 20px;
}

.spider-nav-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.spider-nav-title::before {
    content: "🕷️";
    font-size: 20px;
}

.spider-nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.spider-nav-item {
    margin: 0;
}

.spider-nav-link {
    display: block;
    padding: 12px 20px;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.spider-nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    text-decoration: none;
    border-left-color: #0073aa;
}

.spider-nav-link.active {
    background: rgba(0,115,170,0.2);
    border-left-color: #0073aa;
    color: #fff;
}

.spider-nav-link.active::after {
    content: "→";
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #0073aa;
    font-weight: bold;
}

/* PRO版本链接特殊样式 */
.spider-nav-pro {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #3c434a;
}

.spider-nav-pro .spider-nav-link {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    font-weight: 600;
    border-radius: 5px;
    margin: 0 10px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.spider-nav-pro .spider-nav-link::before {
    content: "✨";
    margin-right: 8px;
    animation: sparkle 2s infinite;
}

.spider-nav-pro .spider-nav-link:hover {
    background: linear-gradient(135deg, #ffed4e, #ffd700);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255,215,0,0.3);
}

@keyframes sparkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 主内容区域 */
.spider-content-area {
    flex: 1;
    margin-left: 250px;
    padding: 20px;
    background: #fff;
    min-height: 100vh;
}

/* 加载状态 */
.spa-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spa-loading p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* 错误状态 */
.spa-error {
    text-align: center;
    padding: 40px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.spa-error h3 {
    color: #d63638;
    margin-bottom: 10px;
}

.spa-error p {
    color: #666;
    margin-bottom: 20px;
}

/* 404状态 */
.spa-404 {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.spa-404 h2 {
    color: #333;
    margin-bottom: 10px;
}

.spa-404 p {
    color: #666;
    margin-bottom: 30px;
}

/* 内容过渡动画 */
.spa-content {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .spa-container {
        flex-direction: column;
    }
    
    .spider-nav-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 10px 0;
    }
    
    .spider-content-area {
        margin-left: 0;
        padding: 15px;
    }
    
    .spider-nav-menu {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        padding: 0 10px;
    }
    
    .spider-nav-item {
        flex: 1;
        min-width: calc(50% - 5px);
    }
    
    .spider-nav-link {
        padding: 8px 12px;
        font-size: 14px;
        text-align: center;
        border-radius: 4px;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    
    .spider-nav-link.active {
        border-left: none;
        border-bottom-color: #0073aa;
    }
    
    .spider-nav-link.active::after {
        display: none;
    }
}

/* 深色主题支持 */
@media (prefers-color-scheme: dark) {
    .spider-nav-sidebar {
        background: #1e1e1e;
    }
    
    .spider-content-area {
        background: #2c2c2c;
        color: #fff;
    }
    
    .spa-error,
    .spa-404 {
        background: #3c3c3c;
        color: #fff;
    }
}

/* 插件内部底部标志样式 - 作为内容的一部分 */
.spider-footer {
    position: relative;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-radius: 4px;
    margin: 20px 0 0 0;
    padding: 15px 20px;
    text-align: center;
    clear: both;
}

/* WordPress管理页面中的底部标志 */
.spider-plugin-footer .spider-footer {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin: 20px 0 0 0;
    padding: 15px 20px;
}

.spider-footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.spider-footer-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: #0073aa;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #0073aa;
    box-shadow: 0 2px 4px rgba(0,115,170,0.1);
}

.spider-footer-logo:hover {
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    background: #0073aa;
    box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

.spider-footer-logo .logo-text {
    position: relative;
}

.spider-footer-logo .logo-text::before {
    content: "⚡";
    margin-right: 6px;
    font-size: 16px;
}

/* 主内容区域正常边距 */
.spider-content-area {
    padding-bottom: 0;
}

/* 打印样式 */
@media print {
    .spider-nav-sidebar {
        display: none;
    }
    
    .spider-content-area {
        margin-left: 0;
        padding: 0;
    }
    
    .spider-footer {
        display: none;
    }
}

/* 无障碍支持 */
.spider-nav-link:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.spider-nav-link:focus:not(:focus-visible) {
    outline: none;
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .spider-nav-sidebar {
        background: #000;
        border-right: 2px solid #fff;
    }
    
    .spider-nav-link {
        border: 1px solid transparent;
    }
    
    .spider-nav-link:hover,
    .spider-nav-link.active {
        border-color: #fff;
        background: #333;
    }
}

/* Ensure chart canvases fit containers and do not overflow */
.trend-chart-container,
.chart-3d-container,
.chart-container {
	position: relative;
	width: 100%;
	height: 350px;
	overflow: hidden;
	box-sizing: border-box;
}

.trend-chart-container canvas,
.chart-3d-container canvas,
#spider-trend-chart,
#spider-activity-chart,
#paths-pie-chart,
#spider-error-chart,
#spider-heatmap,
#spider-sources-premium,
#trend-chart,
#chart-3d {
	display: block;
	max-width: 100% !important;
	width: 100% !important;
	height: 100% !important;
	box-sizing: border-box;
}

/* Avoid double scrollbars causing layout shift */
.chart-layout,
.trend-layout { 
	overflow: hidden;
}
